<?php
ob_start();
if(!$_COOKIE['acesso']) {
	$url_ok = $_SERVER[QUERY_STRING];
	header("Location: login.php?$url_ok");
}
header("Content-Type:text/html; charset=utf-8",true);
if ($_COOKIE['acesso']) {
	$login = explode(",",$_COOKIE['acesso']);
	$session_id = $login[0];
	$session_usuario = $login[1];
	$session_nome = $login[2];
	$session_area = $login[3];
	$session_perfil = $login[4];
	$session_sistemas = $login[5];
}
include 'config.php';
include 'functions.php';
include './includes/classes/conexao.class.php';
$bd = 'gw';
$conexao = new Conexao($bd);
$tratamento_de_erros = set_error_handler("TrataErros");
$aplicativo = '';
$subaplicativo = '';
if(isset($_GET["aplicativo"]))$aplicativo=$_GET["aplicativo"];
if(isset($_GET["subaplicativo"]))$subaplicativo=$_GET["subaplicativo"];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<title><?php echo SISTEMA ?></title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel='stylesheet' type='text/css' href='<?php echo $css ?>/index.css' />
	<link rel="stylesheet" href="<?php echo $js ?>/jquery/themes/getnet/ui.all.css" type="text/css" media="screen" title="Flora (Default)" />
	<!-- jQuery -->
	<script type="text/javascript" src="<?php echo $js ?>/jquery/jquery-1.3.2.min.js"></script>
	<script type="text/javascript" src="<?php echo $js ?>/jquery/ui/ui.core.js"></script>
	<script type="text/javascript" src="<?php echo $js ?>/jquery/ui/ui.accordion.js"></script>
	<script type="text/javascript" src="<?php echo $js ?>/jquery/ui/ui.tabs.js"></script>
	<script type="text/javascript" src="<?php echo $js ?>/jquery/ui/ui.sortable.js"></script>
	<script type="text/javascript" src="<?php echo $js ?>/jquery/ui/ui.draggable.js"></script>
	<script type="text/javascript" src="<?php echo $js ?>/jquery/ui/ui.resizable.js"></script>
	<script type="text/javascript" src="<?php echo $js ?>/jquery/ui/ui.dialog.js"></script>
	<script type="text/javascript" src="<?php echo $js ?>/jquery/ui/ui.datepicker.js"></script>
	<script type="text/javascript" src="<?php echo $js ?>/jquery/ui/effects.core.js"></script>
	<script type="text/javascript" src="<?php echo $js ?>/jquery/ui/effects.highlight.js"></script>
	<script type="text/javascript" src="<?php echo $js ?>/jquery/ui/ext/bgiframe/jquery.bgiframe.js"></script>
	<!-- Extensão TreeView do jQuery -->
	<link rel="stylesheet" type="text/css" href="<?php echo $js ?>/jquery/ext/treeview/jquery.treeview.css" />
	<script src="<?php echo $js ?>/jquery/ext/treeview/lib/jquery.cookie.js" type="text/javascript"></script>
	<script src="<?php echo $js ?>/jquery/ext/treeview/jquery.treeview.js" type="text/javascript"></script>	
	<style type="text/css">
		#column-left { width: 65%; float: left; padding-bottom: 100px; }
		#column-right { width: 30%; float: left; padding-bottom: 100px; }
		.portlet { margin: 0 1em 1em 0; }
		.portlet-header { border: 0px; padding: 4px 0 4px 0.2em; }
		.portlet-header .ui-icon { float: right; }
		.portlet-content { padding: 0.4em; }
		.portlet-content li { list-style: disc; margin: 0 0 0 2em }
		.ui-sortable-placeholder { background: #eee; border: 1px dashed gray; visibility: visible !important; height: 50px !important; }
		.ui-sortable-placeholder * { visibility: hidden; }
	</style>	
	<!-- Script de criação do menu -->
	<script type='text/javascript'>
		$(document).ready(function(){
			$("#navigation").treeview({
				persist: "cookie",
				cookieId: "treeview-black"
			});
			$(".campo_data").datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'dd/mm/yy'
			});
			//Funções da página inicial;
			$(function() {
				$("#column-left, #column-right").sortable({
					connectWith: '.principal'
				});

				$(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
					.find(".portlet-header")
						.addClass("ui-widget-header ui-corner-all")
						.prepend("<span class='ui-icon ui-icon-triangle-1-n'></span>")
						.end()
					.find(".portlet-content");

				$(".portlet-header .ui-icon").click(function() {
					$(this).toggleClass("ui-icon-triangle-1-s");
					$(this).parents(".portlet:first").find(".portlet-content").toggle();
				});

				$('.portlet-header').hover(
						function() { $(this).css('cursor', 'move'); } 
				);
				
				$('.portlet-header .ui-icon').hover(
						function() { $(this).css('cursor', 'pointer'); } 
				);

				$(".column").disableSelection();
			});
		});		  
	</script>
</head>
<body>
<div id="geral">
	<div id="topo">
		<a href="./" title="Página Inicial"><img src="<?php echo $imagens ?>/cabecalhoGetNet-Fundo.png" alt="GetNet Tecnologia" title="GetNet Tecnologia - Página Inicial" /></a>
		<div id="titulo">
			Gerenciador de Sistemas GetNet
		</div>
		<div id="painel">
		<a href="?aplicativo=internos&subaplicativo=lista-telefonica" title="Lista Telefônica"><img src="<?php echo $imagens ?>/telefones.png" alt="Logout" title="Lista Telefônica" /></a>
		<a href="logout.php" title="Sair do sistema"><img src="<?php echo $imagens ?>/logout.png" alt="Logout" title="Sair do sistema" /></a>
		</div>
	</div>